import { Component } from '@angular/core';
import {CarouselService} from "../service/carousel.service";
import {Carousel} from "../model/Carousel";
import {ConfigService} from "../service/config.service";
import {AuthService} from "../service/auth.service";

@Component({
  selector: 'app-tab3',
  templateUrl: 'tab3.page.html',
  styleUrls: ['tab3.page.scss']
})
export class Tab3Page {
  cl:Array<Carousel>;
  isregistuser:boolean;
  hosturl:string;
    slideOpts = {
        initialSlide: 1,
        speed: 400
    };


  constructor(private carouselservice:CarouselService,private config:ConfigService,
  private authservice:AuthService) {
    this.cl=new Array();
    this.hosturl=this.config.HOST;
    this.hosturl+="/public/";
    this.isregistuser=false;
  }


    ionViewWillEnter(){
    //this.loadCarouselFormServer();
    this.isRegist();
    }



  loadCarouselFormServer(){

    this.carouselservice.getCarouselList()
        .then((data:any)=>{
          this.cl=new Array();
          this.cl=data;


        })


  }

  isRegist(){
this.authservice.isRegistUser()
    .then((data:any)=>{

    if(data.msg==true){
        this.isregistuser=true
    }
    else{
        this.isregistuser=false;
    }


    })


  }


}
